package com.fb;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ImageDecoder;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.webkit.MimeTypeMap;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.fb.FileBrowserPage;
import com.dev.ArchiveListTab;
import com.dev.CEditorTab;
import com.dev.DocumentFile;
import com.dev.FileProvider;
import com.dev.HtmlBrowser;
import com.dev.HtmlIndentEditor;
import com.dev.IconView;
import com.dev.ImageManipulationTab;
import com.dev.IndentEditor;
import com.dev.JavaEditorPage;
import com.dev.JavaEditorTab;
import com.dev.JavaIndentEditor;
import com.dev.MainActivity;
import com.dev.QueryOpenFile;
import com.dev.R;
import com.dev.TabBar;
import com.dev.TabData;
import com.log;
import java.io.File;
import java.io.FileReader;
import java.net.URI;
import java.util.LinkedList;
import java.util.Stack;
class FileItem extends LinearLayout implements OnClickListener{
    final static String err1="NullPointer";
	IconView ivtype;
	LinearLayout linear;
	TextView name;
	TextView info;
	//TreeNode node;
	boolean b;
	ColorDrawable sed=new ColorDrawable(0x77ffff00);
	FileBrowserPage.Pressed pressed=new FileBrowserPage.Pressed();
	int dividerHeight=1;
	int indent;
	FileBrowserPage fbp;
    File file;
    int index;
    Thread iconLoader;
	String err;
	MainActivity ma;
	FileItem(FileBrowserPage fbp){
		super(fbp.ma);
	}
	@Override
	public void onClick(View v){
		if(v==this){
			if(fbp.selected==null){
				if(file.isDirectory()){
					if(fbp.indentItem&&!fbp.ivMeans.isSelected()||!fbp.indentItem&&fbp.ivMeans.isSelected()){
						if(file.canRead()){//code it 
							if(fbp.willshowOpened[index]){
                                /*fbp.willshowOpened[index]=false;
                                TreeNode[] tns=fbp.willshowTree[index];
                                int count=tns.length;
                                Stack<TreeNode> stack=new Stack<TreeNode>();
                                for(int pos=0;pos<tns.length;pos++){
                                    TreeNode tn=tns[pos];
                                    stack.clear();
                                    do{
                                        if(tn.opened){
                                            TreeNode[] nodes=tn.nodes;
                                            count+=nodes.length;
                                            for(TreeNode n:nodes){
                                                stack.push(n);
                                            }
                                        }
                                        tn=stack.pop();
                                    }while(!stack.isEmpty());
                                }
                                
								//TreeNode[] willshow_will=new TreeNode[fbp.willshowLen-count];
								//System.arraycopy(fbp.willshow,0,willshow_will,0,index+1);
                                int len=fbp.willshowLen-index-1-count;
                                int loc=index+1+count;
                                System.arraycopy(fbp.willshow,loc,fbp.willshow,index+1,len);
                                System.arraycopy(fbp.willshowIcons,loc,fbp.willshowIcons,index+1,len);
                                System.arraycopy(fbp.willshowOpened,loc,fbp.willshowOpened,index+1,len);
                                System.arraycopy(fbp.willshowTree,loc,fbp.willshowTree,index+1,len);
                                System.arraycopy(fbp.willshowSizes,loc,fbp.willshowSizes,index+1,len);
								//System.arraycopy(fbp.willshow,index+1+count,willshow_will,index+1,fbp.willshowLen-index-1-count);
								if(fbp.selected!=null){
									boolean[] selected_will=new boolean[fbp.willshowLen-count];
									System.arraycopy(fbp.selected,0,selected_will,0,index+1);
									System.arraycopy(fbp.selected,index+1+count,selected_will,index+1,fbp.willshowLen-index-1-count);
									fbp.selected=selected_will;
								}
								//fbp.willshow=willshow_will;
								//fbp.willshowLen=willshow_will.length;
                                fbp.willshowLen-=count;
								fbp.dlv.invalidate()*/
							}else{//coding
                                
							}
						}
					}
				}
			}
		}
	}
}
